package com.wanmait.employment.manageController;


import com.github.pagehelper.PageInfo;
import com.wanmait.employment.entity.Position;
import com.wanmait.employment.entity.PositionType;
import com.wanmait.employment.service.PositionService;
import com.wanmait.employment.service.PositionTypeService;
import com.wanmait.employment.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("manage/position")
public class PositionController {


    @Resource
    private PositionService positionService;

    @Resource
    private PositionTypeService positionTypeService;

    @RequestMapping("list")
    public AjaxResult list (String title, Integer pageNum, Integer pageSize){
        PageInfo<Position> pageInfo=positionService.list(title,pageNum,pageSize);
        return AjaxResult.success("",pageInfo);
    }

    @GetMapping("listAll")
    public AjaxResult listAll(){
        List<PositionType> positionTypeList=positionTypeService.listAll();
        return AjaxResult.success(positionTypeList);
    }
    @PostMapping("update")
    public AjaxResult update(@RequestBody Position position){
        positionService.update(position);
        return AjaxResult.success();
    }
}
